package com.shrct.businessprocess.organization.impl;

import com.shrct.businessprocess.organization.RCBusinessProcessorAssignment;
import com.shrct.businessprocess.organization.RCEmployee;
import com.shrct.businessprocess.organization.impl.RCEmployeeImpl;
import com.shrct.businessprocess.organization.proxy.RCBusinessProcessorAssignmentProxy;
import edu.fudan.mylang.pf.BaseModelObject;
import edu.fudan.mylang.pf.IObjectFactory;
import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.hibernate.annotations.DiscriminatorOptions;

@Entity
@DiscriminatorValue("RCBUSINESSPROCESSORASSIGNMENT_TYPE")
@DiscriminatorOptions(force = true)
@DiscriminatorColumn(length = 64)
@Table(name = "rcbusinessprocessorassignment")
public class RCBusinessProcessorAssignmentImpl extends BaseModelObject implements RCBusinessProcessorAssignment {
  public RCBusinessProcessorAssignmentImpl() {
    super();
  }
  
  @JoinColumn(name = "saler_id")
  @ManyToOne(targetEntity = RCEmployeeImpl.class, cascade = { CascadeType.MERGE, CascadeType.PERSIST })
  private RCEmployee saler;
  
  public RCEmployee getSaler() {
    return this.saler;
  }
  
  public RCBusinessProcessorAssignment setSaler(final RCEmployee saler) {
    this.saler = saler;
    return this;			
    
  }
  
  @JoinColumn(name = "businessMan_id")
  @ManyToOne(targetEntity = RCEmployeeImpl.class, cascade = { CascadeType.MERGE, CascadeType.PERSIST })
  private RCEmployee businessMan;
  
  public RCEmployee getBusinessMan() {
    return this.businessMan;
  }
  
  public RCBusinessProcessorAssignment setBusinessMan(final RCEmployee businessMan) {
    this.businessMan = businessMan;
    return this;			
    
  }
  
  public static RCBusinessProcessorAssignment create(final IObjectFactory objectFactory) {
    com.shrct.businessprocess.organization.RCBusinessProcessorAssignment rCBusinessProcessorAssignment = new com.shrct.businessprocess.organization.impl.RCBusinessProcessorAssignmentImpl(
    );
    objectFactory.create(rCBusinessProcessorAssignment);
    return rCBusinessProcessorAssignment;			
    
  }
  
  public static RCBusinessProcessorAssignment createRCBusinessProcessorAssignmentImpl(final IObjectFactory objectFactory, final Procedure1<RCBusinessProcessorAssignment> init) {
    com.shrct.businessprocess.organization.RCBusinessProcessorAssignment rCBusinessProcessorAssignment = new com.shrct.businessprocess.organization.impl.RCBusinessProcessorAssignmentImpl(
    );
    objectFactory.create(rCBusinessProcessorAssignment);
    init.apply(rCBusinessProcessorAssignment);
    
    return rCBusinessProcessorAssignment;			
    
  }
  
  public RCBusinessProcessorAssignmentProxy toProxy() {
    com.shrct.businessprocess.organization.proxy.RCBusinessProcessorAssignmentProxy proxy = new com.shrct.businessprocess.organization.proxy.RCBusinessProcessorAssignmentProxy();
    proxy.setId(this.getId());
    if(this instanceof edu.fudan.mylang.pf.INamedModelObject){
    	proxy.setName(((edu.fudan.mylang.pf.INamedModelObject)this).getEntityName());
    }
    return proxy;
    
  }
}
